import { User, UserSearchOnlyIdAndEmail } from "../user";

// 用户列表
export interface ListResponse<T = any> {
    total: number;
    list: T[];
}

// 搜索的用户列表
export interface SearchListResponse {
    list: UserSearchOnlyIdAndEmail[];
    total: number;
}

export interface IResponse<T> {
    message: string;
    code: number;
    result: T;
}

// 登录返回的数据
export interface LoginResult {
    token: string;
}
// 注册成功返回的数据
export interface RegisterResult {
    token: string;
}

// 产品类型
export interface BuyProduct {
    pId: number;
    pName: string;
    buyPrice: number;
    buyQuantity: number;
    buyAt: string;
    buyOrderNumber: number;
    buyWay: string;
}

// 用户购买记录的返回数据
export interface UserBuyRecordResult {
    list: BuyProduct[];
    total: number;
}

// 产品信息返回数据
export interface ProductInfoResult {
    pName: string;
    pTag: string[];
    pImgPath: string[];
    pTitle: string;
    pEffect: string[];
    pDetail: string;
    pSoldOut: string;
    pPrice: string;
    pRote: number;
    pCreateAt: string;
    pUnderAt: string;
    pUnder: boolean;
}

// 产品列表返回数据
export interface ProductListResult {
    list: ProductInfoResult[];
    total: number;
}

/**
 * 通知
 */
export interface NoticeInfo {
    n_id: number;
    sender_email: string;
    sender_username: string;
    sender_uid: number;
    n_title: string;
    notice_type: 'important' | 'general';
    n_content: string;
    n_time: string;
    recipient: 'all' | string[];
}
export interface NewNoticeParams {
    n_id: number;
    sender_email: string;
    sender_username: string;
    sender_uid: number;
    n_title: string;
    notice_type: 'important' | 'general';
    n_content: string;
    n_time: string;
    recipient: 'all' | 'specific';
    recipientUIDs: number[];
}

export interface Notice {
    id: string; // JSON 中的 bigint 通常以 string 格式表示
    senderEmail: string;
    senderUsername: string;
    senderUid: string; // JSON 中的 bigint 通常以 string 格式表示
    title: string;
    noticeType: 'important' | 'general'; // 枚举类型
    content: string;
    noticeTime: string; // ISO 8601 格式的日期时间字符串
    recipientType: 'all' | string[]; // 枚举类型
    //xhr.status:获取当前服务器的响应状态  200=>成功
    status: string;
    read_time: string;
}
// 通知列表返回数据
export interface NoticeListResult {
    list: Notice[];
    total: number;
}